package cn.dengta.context.model;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

@Slf4j
public enum AppContext {
	INTER("main", "国内"),
	OUT("inchat", "海外"),
	;
	public String value;
	public String label;

	public static AppContext current = INTER;

	AppContext(String value, String label) {
		this.value = value;
		this.label = label;
	}

	public static void init(String appName) {
		for (AppContext value : AppContext.values()) {
			if (StringUtils.startsWith(appName, value.value)) {
				current = value;
				break;
			}
		}
		log.info("当前应用环境：{}", current.label);
	}

	public static boolean inter() {
		return INTER == current;
	}

}
